package com.nimitz.modules.approval.service.impl;


import com.nimitz.modules.approval.domain.ApprovalInstance;
import com.nimitz.modules.approval.mapper.ApprovalInstanceMapper;
import com.nimitz.modules.approval.service.IApprovalInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ApprovalInstanceServiceImpl
 * @Author FuCun
 * @Date 2021-08-17-14:45
 * @PackageName com.nimitz.modules.approval.service.impl
 * @Description 审批实例-实现
 * @Version 1.0.0
 */
@Service
public class ApprovalInstanceServiceImpl  implements IApprovalInstanceService {
    @Autowired
    private ApprovalInstanceMapper approvalInstanceMapper;

    /**
     * 查询所有审批实例（含搜索）
     *
     * @param approvalInstance 审批实例
     * @return 审批人员集合
     */
    @Override
    public List<ApprovalInstance> selectApprovalInstanceList(ApprovalInstance approvalInstance) {
        return approvalInstanceMapper.selectApprovalInstanceList(approvalInstance);
    }

    /**
     * 新增审批实例
     *
     * @param approvalInstance 审批实例
     * @return 结果
     */
    @Override
    public int insertApprovalInstance(ApprovalInstance approvalInstance) {
        return approvalInstanceMapper.insertApprovalInstance(approvalInstance);
    }

    /**
     * 修改审批实例
     *
     * @param approvalInstance 审批实例
     * @return 结果
     */
    @Override
    public int updateApprovalInstance(ApprovalInstance approvalInstance) {
        return approvalInstanceMapper.updateApprovalInstance(approvalInstance);
    }

    /**
     * 删除审批实例
     *
     * @param instanceId 审批实例id
     * @return 结果
     */
    @Override
    public int deleteApprovalInstanceByInstanceId(Long instanceId) {
        return approvalInstanceMapper.deleteApprovalInstanceByInstanceId(instanceId);
    }

    /**
     * 校验审批实例编号是否唯一
     *
     * @param instanceNo 审批实例编号
     * @return 结果
     */
    @Override
    public ApprovalInstance checkApprovalInstanceIdUnique(Long instanceNo) {
        return approvalInstanceMapper.checkApprovalInstanceIdUnique(instanceNo);
    }
}
